
"""任务页面基类"""


from selenium.webdriver.common.by import By
from pages.base_page import BasePage

class RwHomePage(BasePage):
    url='/crm/index.php?m=task'
    #任务
    rw_home_locator = (By.LINK_TEXT, '任务')
    #定位器
    task_add_locator = (By.XPATH,'/html/body/div[5]/div[2]/div[1]/div/a')
    #首页
    shouye_renwu_locator = (By.LINK_TEXT,'首页')
    #第二页
    twoye_locator=(By.CSS_SELECTOR,'#form1 > table > tfoot > tr > td > div.pagination > div.span4 > div > ul > li:nth-child(3) > a:nth-child(2)')
    #任务统计
    tongji_renwu_locator = (By.CSS_SELECTOR, 'body > div.container > div:nth-child(1) > ul > li:nth-child(2) > a')

    #勾选删除框
    del_locator = (By.CSS_SELECTOR,'#form1 > table > tbody > tr:nth-child(1) > td:nth-child(1) > input')

    #确定删除键
    del_btn_locator = (By.ID,'delete')

    #点击任务
    def click_task(self):
        self.driver.find_element(*self.rw_home_locator).click()
    #点击添加任务
    def add_task(self):
       self.driver.find_element(*self.task_add_locator).click()
    #点击首页
    def click_renwu_shouye(self):
        self.driver.find_element(*self.shouye_renwu_locator).click()
    #点击第二页
    def click_renwu_twoye(self):
        self.driver.find_element(*self.twoye_locator).click()
    #点击任务统计
    def click_renwu_tj(self):
        self.driver.find_element(*self.tongji_renwu_locator).click()

    #勾选要删的数据
    def del_task(self):
        self.driver.find_element(*self.del_locator).click()

    #确定删除键
    def del_btn(self):
        self.driver.find_element(*self.del_btn_locator).click()